/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author MANUEL
 */
@Entity
@Table(name = "AREA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Area.findAll", query = "SELECT a FROM Area a"),
    @NamedQuery(name = "Area.findByNumArea", query = "SELECT a FROM Area a WHERE a.numArea = :numArea"),
    @NamedQuery(name = "Area.findByArea", query = "SELECT a FROM Area a WHERE a.area = :area")})
public class Area implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "NUM_AREA")
    private Integer numArea;
    @Column(name = "AREA")
    private String area;
    @OneToMany(mappedBy = "areaNumArea")
    private Collection<PersonaAtencion> personaAtencionCollection;
    @OneToMany(mappedBy = "numArea")
    private Collection<Ticket> ticketCollection;
    @OneToMany(mappedBy = "numArea")
    private Collection<TipoServicio> tipoServicioCollection;

    public Area() {
    }

    public Area(Integer numArea) {
        this.numArea = numArea;
    }

    public Integer getNumArea() {
        return numArea;
    }

    public void setNumArea(Integer numArea) {
        this.numArea = numArea;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    @XmlTransient
    public Collection<PersonaAtencion> getPersonaAtencionCollection() {
        return personaAtencionCollection;
    }

    public void setPersonaAtencionCollection(Collection<PersonaAtencion> personaAtencionCollection) {
        this.personaAtencionCollection = personaAtencionCollection;
    }

    @XmlTransient
    public Collection<Ticket> getTicketCollection() {
        return ticketCollection;
    }

    public void setTicketCollection(Collection<Ticket> ticketCollection) {
        this.ticketCollection = ticketCollection;
    }

    @XmlTransient
    public Collection<TipoServicio> getTipoServicioCollection() {
        return tipoServicioCollection;
    }

    public void setTipoServicioCollection(Collection<TipoServicio> tipoServicioCollection) {
        this.tipoServicioCollection = tipoServicioCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numArea != null ? numArea.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Area)) {
            return false;
        }
        Area other = (Area) object;
        if ((this.numArea == null && other.numArea != null) || (this.numArea != null && !this.numArea.equals(other.numArea))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Area[ numArea=" + numArea + " ]";
    }
    
}
